package com.atguigu.java8.datetime;

import org.junit.Test;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class TestDateTimeFormatter {

    @Test
    public void test1() {
        DateTimeFormatter isoDate = DateTimeFormatter.ISO_DATE;
        LocalDateTime now = LocalDateTime.now();
        String format = now.format(isoDate);
        System.out.println(format);

        System.out.println("-----------------------------------------------");

        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        String format1 = now.format(dateTimeFormatter);
        System.out.println(format1);

        LocalDateTime localDateTime = LocalDateTime.parse(format1, dateTimeFormatter);
        System.out.println(localDateTime);
    }

}
